
package com.yuan.application;

import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer;
import com.yuan.graduate.R;

public class ImageLoaderManage {
    private static ImageLoaderManage sInstance = null;
    private DisplayImageOptions options;
    private ImageLoader imageLoader = ImageLoader.getInstance();;

    public DisplayImageOptions getOptions() {
        return options;
    }

    public void setOptions(DisplayImageOptions options) {
        this.options = options;
    }

    public ImageLoader getImageLoader() {
        return imageLoader;
    }

    public void setImageLoader(ImageLoader imageLoader) {
        this.imageLoader = imageLoader;
    }

    private ImageLoaderManage() {
        options = new DisplayImageOptions.Builder()
                .showImageOnLoading(R.drawable.ic_stub)
                .showImageForEmptyUri(R.drawable.ic_empty)
                .showImageOnFail(R.drawable.ic_error)
                .cacheInMemory(true)
                .cacheOnDisc(true)
                .considerExifParams(true)
                .displayer(new RoundedBitmapDisplayer(20))
                .build();
    }

    public static ImageLoaderManage getInstance() {
        if (sInstance == null) {
            synchronized (ImageLoaderManage.class) {
                if (sInstance == null) {
                    sInstance = new ImageLoaderManage();
                }
            }
        }
        return sInstance;
    }
}
